package com.le.tester.controller;

import com.le.tester.common.ServerResponse;
import com.le.tester.dto.UserRegisterDto;
import com.le.tester.sevice.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 描述：用户控制层
 */
@Controller
@RequestMapping("/user/")
public class UserController {
    private static final Logger LOG = LoggerFactory.getLogger(UserController.class);

    @Autowired
    private UserService userService;

    @ResponseBody
    @RequestMapping(value = "register")
    public ServerResponse<String> stockReduce(@RequestParam("phone") String phone, @RequestParam("name") String name) {
        UserRegisterDto userRegisterDto = new UserRegisterDto();
        userRegisterDto.setPhone(phone);
        userRegisterDto.setName(name);
        String result = userService.register(userRegisterDto);
        return ServerResponse.createBySuccess(result);

    }
}
